// 提交链接：https://leetcode.cn/problems/find-the-maximum-number-of-marked-indices/description/
// lc2576. 求出最多标记下标 
// 完成日期：2024/9/21
// c++ 双指针 贪心

class Solution {
public:
    int maxNumOfMarkedIndices(vector<int>& nums) {
        sort(nums.begin(),nums.end());
        int i = 0, n = nums.size();
        for(int j = (n + 1) / 2; j < n; ++j)
        {
            if(nums[i] * 2 <= nums[j])  ++i;
        }
        return i * 2;
    }
};